<template>
  <div>
    <CategorySelector style="margin-bottom:10px" :disabledSelector="scene===1"></CategorySelector>
    <el-card>
      <SpuList v-if="scene===1" @changeScene="saveScene" @getData="saveData"></SpuList>
      <SpuForm v-if="scene===2" @changeScene="saveScene" :currentSpuInfo="currentSpuInfo" aaa="10" bbb="20"></SpuForm>
      <SkuForm v-if="scene===3" @changeScene="saveScene"></SkuForm>
    </el-card>
  </div>
</template>

<script  lang="ts">
import CategorySelector from '@/components/CategorySelelctor/index.vue';
import SpuList from './components/spuList.vue';
import SpuForm from './components/spuForm.vue';
import SkuForm from './components/skuForm.vue';
export default {
  name: 'Spu',
  components: {
    CategorySelector,
    SpuList,
    SpuForm,
    SkuForm
  }
};
</script>
<script lang="ts" setup>
import { ref, reactive } from 'vue';
const scene = ref(1);
const currentSpuInfo = ref({});

// 1. 修改scene的值
const saveScene = (val: number) => {
  scene.value = val;
};

// 2. 获取待编辑的spuInfo数据
const saveData = val => {
  currentSpuInfo.value = val;
};
</script>

<style>
</style>

